import request from '@/utils/request'

export const listGroupbuyProducts = (page = 1, size = 8) =>
  request.get('/api/groupbuy/products', { params: { page, size } })

export const detailByActivity = (promotionId) =>
  request.get(`/api/groupbuy/activity/${promotionId}`);

export const openGroup = (dto) =>
  request.post('/api/groupbuy/open', dto)

export const getGroupDetailById = (groupId) =>
  request.get(`/api/groupbuy/group/${groupId}`);

export const joinGroupByCode = (dto) =>
  request.post('/api/groupbuy/join', dto)

  export const getGroupDetailByCode = (inviteCode) =>
  request.get(`/api/groupbuy/group/code/${inviteCode}`);

